package com.zsp.coupon.filter;


import javax.servlet.http.HttpServletRequest;

/**
 * 校验请求传递中的token
 */
public class TokemFilter extends AbstactPreZuulFilter{
    @Override
    protected Object cRun() {
     HttpServletRequest request=content.getRequest();
        System.out.println(String.format("%s request to %s",
                request.getMethod(), request.getRequestURL().toString()));
           Object token=request.getParameter("token");
           if (null ==token){
               System.out.println("error:token is empty");
               return fail(401,"error :token is empty");
           }
        return success();
    }

    @Override
    public String filterType() {
        return null;
    }


    @Override
    public int filterOrder() {
        return 1;
    }
}
